//
//  L2MutableString.h
//  Lesson2
//
//  Created by Alexander Trifonov on 20.04.12.
//  Copyright (c) 2012 fgengine@gmail.com. All rights reserved.
//

#import "L2MutableString.h"

@implementation L2MutableString

- (void) execute
{
    NSMutableString *s1 = [NSMutableString stringWithCapacity:10];
    NSMutableString *s2 = [[NSMutableString alloc] initWithCapacity:10];
    [s2 release];
    
    NSLog(@"-L2MutableString------------------------");
    
    [s1 appendString:@"First string "];
    NSLog(@"%@", s1);
    
    [s1 appendFormat:@"%@ Objective-C", @"Hello"];
    NSLog(@"%@", s1);
    
    NSLog(@"----------------------------------------");
    
    [s1 deleteCharactersInRange:NSMakeRange(0, 13)];
    NSLog(@"%@", s1);
    
    NSLog(@"----------------------------------------");
    
    [s1 insertString:@" alive!" atIndex:s1.length];
    NSLog(@"%@", s1);
    
    NSLog(@"----------------------------------------");

    [s1 replaceCharactersInRange:NSMakeRange(18, 5) withString:@"World"];
    NSLog(@"%@", s1);
    
    NSLog(@"----------------------------------------");
    
    [s1 replaceOccurrencesOfString:@"World" withString:@"alive" options:NSCaseInsensitiveSearch range:NSMakeRange(0, s1.length)];
    NSLog(@"%@", s1);
    
    NSLog(@"----------------------------------------");
    
    [s1 setString:@"This is a new string"];
    NSLog(@"%@", s1);
    
    NSLog(@"----------------------------------------");
}

@end
